<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="calendar.css">
    <script src="jquery.min.js"></script>
    <script src="calendar.js"></script>
    <style>
        html {
            font: 500 14px 'roboto';
            color: #333;
            background-color: #fafafa;
        }
        a {
            text-decoration: none;
        }
        ul, ol, li {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        #demo {
            width: 300px;
            margin: 150px auto;
        }
        p {
            margin: 0;
        }
        #dt {
            margin: 30px auto;
            height: 28px;
            width: 200px;
            padding: 0 6px;
            border: 1px solid #ccc;
            outline: none;
        }
    </style>
</head>
<body>
<div id="demo">
    <div id="ca"></div>
    <input type="text" id="dt" placeholder="trigger calendar">
    <div id="dd"></div>
</div>
<div></div>
</body>
<script type="text/javascript">
    $('#ca').calendar({
        width: 320,
        height: 320,
        data: [
            {
                date: '2015/12/24',
                value: 'Christmas Eve'
            },
            {
                date: '2015/12/25',
                value: 'Merry Christmas'
            },
            {
                date: '2016/01/01',
                value: 'Happy New Year'
            }
        ],
        onSelected: function (view, date, data) {
            console.log(formatDate(date))
        }
    });

    $('#dd').calendar({
        trigger: '#dt',
        zIndex: 999,
        format: 'yyyy-mm-dd',
        onSelected: function (view, date, value) {
            formatDate(date);
        },
        onClose: function (view, date, data) {
        }
    });
    function formatDate(now) {
        var year=now.getFullYear();;
        var month=now.getMonth()+1;
        var date=now.getDate();
        return year+"-"+month+"-"+date;
    }
</script>

<script>
    $(function () {
//        var url = "http://192.168.0.183:8000/shares/get_k_data/?code=sh000001&format=json&type=60";
        var url = "http://192.168.0.183:8000/shares/get_k_data/?code=sh000001&format=json&type=60";
        var arr = [];
        $.get(url, function(result){
//            result = result.split(',');
//            for(var i in result){
//                arr.push(result[i]);
//            }
            var arr = [];
            result = result.split('\n');
            for(var i in result){
                arr.push(result[i].split(','));
            }
            console.log(arr);
//            result = JSON.parse(result);
//            for(var i in result){
//                console.log(result[i]);
//                for(var j in result[i]){
//                    console.log(result[i][j]);
//                }
//            }
        });
    })
</script>
</html>